﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using CommunitySystem.PublicOfficialSelectionService;

namespace CommunitySystem.PageView
{
    public partial class KaoGuanDetailWindows : ChildWindow
    {
        private PublicOfficialSelectionServiceClient Client = new PublicOfficialSelectionServiceClient();
        private KaoGuanModel model = new KaoGuanModel();
        private string _kgids = "";
        public KaoGuanDetailWindows(string kgids)
        {
            InitializeComponent();
            _kgids = kgids;
               this.DataContext = model;

             
            Client.UpdateKaoGuanDetailModelByidsCompleted += new EventHandler<UpdateKaoGuanDetailModelByidsCompletedEventArgs>(Client_UpdateKaoGuanDetailModelByidsCompleted);
        }

        void Client_UpdateKaoGuanDetailModelByidsCompleted(object sender, UpdateKaoGuanDetailModelByidsCompletedEventArgs e)
        {
            if (e.Result == true)
            {
                SilverlightMessageBoxLibrary.Message.InfoMessage("设置成功！");
                this.DialogResult = true;
            }
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {

            Client.UpdateKaoGuanDetailModelByidsAsync(_kgids, model.KGType);
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }
    }
}

